home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2938 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: sn.no!not-for-mail
  2. From: ilan@sn.no (Ilan Sharoni)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Variable > string ?
  5. Date: 7 Feb 1996 07:09:45 +0100
  6. Organization: SN Internett
  7. Message-ID: <4f9fn9$q6c@sinsen.sn.no>
  8. References: <4evded$p1j@nntp.novia.net>
  9. NNTP-Posting-Host: sinsen.sn.no
  10. X-Newsreader: THOR 2.0 (SOUP)
  11.  
  12. On 03-Feb-96 10:29:33, Tony Syslo (tsyslo@oasis.novia.net) Wrote:
  13. >I'm posting this for a friend:
  14. > Okay, here is another question I have..
  15. >
  16. > Message start:
  17. > Okay, I have also figured out the Timer usage, on how to figure the system
  18. > time, but now, I am wondering, how can I take a variable (say y=123456789)
  19. > and get the last two characters, ie, 89... Is it some sort of str___()
  20. > command? Also, how could I take the FIRST two characters, ie 12... ?? Thanx
  21. > for any and all help... Message End:
  22. >
  23. > Thanx again..
  24.  
  25. If you only want to display it, use printf("%2s",y);
  26. Otherwise stci_d() converts an integer to a decimal string (SAS/C),
  27. stci_o converts integer to octal, stcl_d converts long to decimal etc.
  28. Try strmid() to extract a substring from a string.
  29.  
  30. If you have SAS/C, you have all of it in the docs.
  31. If you have another compiler try sprintf()
  32.  
  33.  
  34. ilan
  35.